<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="js/jquery.js"></script>
        <title></title>
    </head>
    <body>
        <a href="javascript:  arr.add(2);">+</a>
        <a href="javascript:arr.minus(1);">-</a>
    </body>
</html>
<script>
    var result = { a: 0, b: 0, c: 0, d: 0, e: 0 };
    $(function() {
        arr.zbval(1);
    });

    var arr = {
        yx: { 1: {
                a: 15,
                b: 10,
                c: 5,
                d: 0
            },
            2: {
                a: 50,
                b: 90,
                c: 50,
                d: 5
            }
        },
        zb: {
            1: {
                a: 45,
                b: 56,
                c: 78,
                d: 20,
                e: 29
            },
            2: {
                a: 30,
                b: 56,
                c: 78,
                d: 20,
                e: 29
            }
        },
        zbval: function(zbid) {
            var zbv = arr.zb[zbid];
            return zbv;
        },
        yxval: function(yxid) {
            var yxv = arr.yx[yxid];
            return yxv;
        },
        minus: function(id) {
            var yxv = arr.zbval(id);
            result.a = result.a - yxv.a;
            result.b = result.b - yxv.b;
            result.c = result.c - yxv.c;
            result.e = result.d - yxv.d;
            alert(result.a + "," + result.b + "," + result.c + "," + result.d + "," + result.e);
        },
        add: function(id) {
            var yxv = arr.zbval(id);
            result.a = result.a + yxv.a;
            result.b = result.b + yxv.b;
            result.c = result.c + yxv.c;
            result.d = result.d + yxv.d;
            alert(result.a + "," + result.b + "," + result.c + "," + result.d + "," + result.e);
        }
    };

</script>
